producer consumer problem in java